import { Router, IRouter } from 'express';
import { miniprogramLogin, adminLogin, getCurrentUser } from '../controllers/auth.controller';
import { authenticateToken } from '../middleware/auth';

const router: IRouter = Router();

/**
 * @route   POST /api/v1/auth/miniprogram/login
 * @desc    小程序登录
 * @access  Public
 * @body    { code: string, nickname?: string, avatarUrl?: string }
 */
router.post('/miniprogram/login', miniprogramLogin);

/**
 * @route   POST /api/v1/auth/admin/login
 * @desc    管理员登录
 * @access  Public
 * @body    { username: string, password: string }
 */
router.post('/admin/login', adminLogin);

/**
 * @route   GET /api/v1/auth/me
 * @desc    获取当前登录用户信息
 * @access  Private (需要JWT认证)
 */
router.get('/me', authenticateToken, getCurrentUser);

export default router;
